{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LinearRegression  # 调用库，sklearn线性模型，线性回归\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAGstJREFUeJzt3X2MXNdZx/Hvk/W23QTKNs22StY1TqXI5sUkblclYKlqHIpbGiWWKZDQQoCiCFFBKWBqCwQUtdjIoBb+oMi0QFBKmpCkTksBE8WpkCKcao3TumljEtrG9jrUixIXkSzN2nn4Y+5k17t3Zu7MfTv33N9Hsnbn7uzsmbve557znOeca+6OiIjE66K6GyAiIuVSoBcRiZwCvYhI5BToRUQip0AvIhI5BXoRkcgp0IuIRE6BXkQkcgr0IiKRW1N3AwAuu+wyX79+fd3NEBFplCNHjvy3u08Nel4QgX79+vXMzs7W3QwRkUYxs6eyPE+pGxGRyA0M9Gb2V2Z2xsy+vOzYPjN73My+ZGafNrPJZV/bbWZPmtlxM9tWVsNFRCSbLD36vwHetuLYA8D3u/sPAP8B7AYws+8Fbga+L/mePzezscJaKyIiQxsY6N39X4FnVhz7F3c/lzw8DKxNPr8J+JS7f9vdvw48CbypwPaKiMiQisjR/wLwT8nn08DJZV87lRwTEZGa5Kq6MbPfBs4Bn+weSnla6p1NzOw24DaAdevW5WmGiMhQDhydY9/B45w+u8AVkxPs3LaB7Zvj7ZOO3KM3s1uBG4B3+dJtqk4Br1v2tLXA6bTvd/f97j7j7jNTUwPLQEVECnHg6By77zvG3NkFHJg7u8Du+45x4Oh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78auAZ4m5ldC/wR8BF3vwp4FnhPjW2s2vuAry573OZzcZ27X7OsdG4X8GByLh5MHrfFnwL/7O4bgavp/B9p3flw9+PJ/4lrgDcCzwOfpsJzoUA/JO/43+ThePLPga3APcnx24HtNTSvcma2FngH8PHksdHSc9HDTXTOAbToXJjZK4E3A58AcPcX3P0sLT0fy1wP/Ke7P0WF50KBfgRJquJR4AzwAPCfwFl3P5c85RTQlk3mPwr8FvBi8vjVtPdcOPAvZnbEzG5Ljr3W3Z8GSD6+prbWVev1wDzw10la7+NmdgntPR9dNwN3Jp9Xdi4U6Efg7ueTYdha4E3A96Q9rdpWVc/MbgDOuPuR5YdTnhr9uUhscfc3AG8H3mtmb667QTVaA7wB+Ji7bwaeowVpmn6Suaobgb+v+mcr0OeQDEU/D1wLTJpZ945da4HTdbWrQluAG83sG8Cn6KRsPko7zwXufjr5eIZODvZNwDfN7HKA5OOZ+lpYqVPAKXd/JHl8D53A39bzAZ0OwL+7+zeTx5WdCwX6IZnZlJlNJp9PAD9CZ5LpIeCdydNuBe6vp4XVcffd7r7W3dfTGZIecvd30cJzYWaXmNl3dj8HfhT4MvAZOucAWnIuANz9v4CTZta90/31wFdo6flI3MJS2gYqPBdaMDUkM/sBOhMnY3QulHe7+x+Y2evp9GovBY4C73b3b9fX0mqZ2VuA33T3G9p4LpL3/Onk4Rrg79z9w2b2auBuYB1wAvgJd3+mpmZWysyuoTNJ/zLga8DPk/zN0LLzYWYXAyeB17v7t5Jjlf3fUKAXEYmcUjciIpFToBcRiZwCvYhI5BToRUQip0AvIhI5BXoRkcgp0IuIRE6BXkQkcv8P16YYQ+8fCuoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#######\n",
      "(100,)\n"
     ]
    }
   ],
   "source": [
    "# 载入数据\n",
    "data = np.genfromtxt(\"data.csv\", delimiter=\",\")\n",
    "x_data = data[:,0]  # 所有行，第0列\n",
    "y_data = data[:,1]\n",
    "plt.scatter(x_data,y_data)  #散点图\n",
    "plt.show()\n",
    "print('#######')\n",
    "print(x_data.shape)  # 100代表100个样本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(100, 1)\n"
     ]
    }
   ],
   "source": [
    "x_data = data[:,0,np.newaxis]  \n",
    "# 100行1列的矩阵，加入一个维度，这是因为sklearn需要将数据这样处理，需是2维格式\n",
    "print(x_data.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_data = data[:,0,np.newaxis]  # \n",
    "y_data = data[:,1,np.newaxis]\n",
    "# 创建并拟合模型\n",
    "model = LinearRegression()  # 实线一个线性回归的类\n",
    "model.fit(x_data, y_data)  # 建模的动作"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHbRJREFUeJzt3X2UHHWd7/H3NzMEE0VjILBIiMA5kXtFHp2LjK4wEh4VgRWWhSOSi7gj5/LsehfDvZwDN0DY9cqDiqzhQWEPEjFcDpy9wMKiI6y0wQmEFfCB8BwJEEC4YiAhM9/7R1VnJpOqnu6u6nrqz+ucnJ6u7un+dU36U7/61q9+Ze6OiIhU15S8GyAiI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uvy6+l2TKzAeDr7n5EN66L8DPfFt7tBX7k7heb2dbALcAc4Hngr9399ZyamSkz24vgIP1U4GngZMLvDF22PsxsOvACsIu7vxkuy+z/hoJeRKTiVLoREak4Bb2ISMUp6EVEKk5BLyJScQp6EZGKU9CLiFScgl5EpOIU9CIiFff/AY7oCER0eEc0AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 画图\n",
    "plt.plot(x_data, y_data, 'b.')  # 蓝色，点\n",
    "plt.plot(x_data, model.predict(x_data), 'r')  # 做预测，计算预测的值，算法实线预测的红色的线，不需手动算法\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
